Ubay ibn Khalaf (Arabic: أبي بن خلف) was a non-Muslim who was a contemporary and an enemy of Muhammad.
He paid his ransom after Badr, but was killed by Muhammad himself with a spear in the Battle of Uhud (625 CE). Verse [Quran 8:17] was revealed in this occasion[1]